package cn.iocoder.yudao.module.system.controller.admin.casedata.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.time.LocalDateTime;
import cn.hutool.core.util.StrUtil;
import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import com.baomidou.mybatisplus.annotation.TableField;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import cn.iocoder.yudao.framework.common.DictTypeConstants;
import cn.iocoder.yudao.framework.dict.core.DictFrameworkUtils;
import org.springframework.format.annotation.DateTimeFormat;

import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY;


@Schema(description = "管理后台 - 案件 Response VO")
@Data
@ExcelIgnoreUnannotated
public class CaseRespVO {
    @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "10058")
    @ExcelProperty("ID")
    private Long id;
    @Schema(description = "案件名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五")
    @ExcelProperty("案件名称")
    private String caseName;
    @Schema(description = "撰写员id")
    @ExcelProperty("撰写员id")
    private Long reviewerBy;
    @Schema(description = "案例类型")
    private String caseType;
    @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
    @ExcelProperty("创建时间")
    @JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY,timezone = "GMT+8")
    @DateTimeFormat(pattern=FORMAT_YEAR_MONTH_DAY)
    private LocalDateTime createTime;
    @Schema(description = "撰写员")
    @TableField(exist = false)
    private String reviewer;

    public String getCaseTypeText() {
        if (StrUtil.isBlank(caseType)){
            return "";
        }
        return DictFrameworkUtils.getDictDataLabel(DictTypeConstants.CASE_TYPE,caseType);
    }
}